<%-- 
    Document   : consultar
    Created on : 02/06/2014, 22:37:17
    Author     : Taynah
--%>

<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>PEDIDOS</h1>
        <table border='1'>
            
        <%
        String cpf=(String)session.getAttribute("cpf");
        Connection con=null;
        Statement stmt=null;
        ResultSet rs=null;
        Class.forName("oracle.jdbc.driver.OracleDriver");
        con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","hr","hr");
        stmt=con.createStatement();
        rs=stmt.executeQuery("SELECT * FROM pedido WHERE cd_cpf_cliente='"+cpf+"'");
        while(rs.next()){ 
           out.println("<tr>");
           out.println("<td>"+rs.getString("cd_pedido")+"</td>");
           out.println("<td>"+rs.getString("dt_pedido")+"</td>");
           out.println("</tr>");
        }
        
        %>
        </table>
    </body>
</html>
